package com.yzion.demo_coollist.net

import com.yzion.baselib.http.ApiHelper
import com.yzion.demo_coollist.model.GankResults
import retrofit2.Callback

/**
 * https://cloud.tencent.com/developer/article/1196315
 */
object GankApi {
    const val API_BASE_URL = "http://gank.io/api/"
    private val service by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
        ApiHelper.get().create(
            API_BASE_URL,
            GankApiService::class.java, GankApiConfig()
        )
    }

    fun getGankData(type: String?, pageSize: Int, pageNum: Int, callback: Callback<GankResults?>?) {
        service.getGankData(type, pageSize, pageNum)!!.enqueue(callback)
    }
}